import request from '@/utils/request'
let baseUrl = process.env.NODE_ENV === 'production' ? 'api/core' : '/core'

export const getProductList = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/product/list',
    method: 'post',
    data
  })
// 下拉框的产品列表
export const getProductDict = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/product/dict',
    method: 'post',
    data
  })
// 还款试算
export const tryCalculate = (data: any) =>
  request({
    baseURL: baseUrl,
    url: '/rate/calculate',
    method: 'post',
    data
  })
export const getProductDetail = (data?: any) =>
  request({
    headers: {
      'Content-type': 'text/plain'
    },
    baseURL: baseUrl,
    url: '/product/query',
    method: 'post',
    data
  })

export const getDetailByProductNo = (data?: any) =>
  request({
    headers: {
      'Content-type': 'text/plain'
    },
    baseURL: baseUrl,
    url: '/product/queryByProNo',
    method: 'post',
    data
  })

export const addProduct = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/product/add',
    method: 'post',
    data
  })

export const updateProduct = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/product/update',
    method: 'post',
    data
  })

export const updateProductStatus = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/product/updateStatus',
    method: 'post',
    data
  })

export const updateProductCheckStatus = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/product/check',
    method: 'post',
    data
  })
export const getAssetList = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/asset/list',
    method: 'post',
    data
  })
// lpr管理
export const lprAdd = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/rate/lpr/add',
    method: 'post',
    data
  })
export const lprUpdate = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/rate/lpr/update',
    method: 'post',
    data
  })
export const lprDelete = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/rate/lpr/delete',
    method: 'post',
    data
  })
export const lprDetermineExits = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/rate/lpr/determineExists',
    method: 'post',
    data
  })
export const lprList = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/rate/lpr/list',
    method: 'post',
    data
  })
export const getOnloadnList = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/asset/onloan/list',
    method: 'post',
    data
  })

export const getFinishList = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/asset/clear/list',
    method: 'post',
    data
  })

export const getOverdueList = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/asset/overdue/list',
    method: 'post',
    data
  })

export const getAccountList = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/account/list',
    method: 'post',
    data
  })

export const getAccountDetail = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/account/query',
    method: 'post',
    data
  })

export const getAssetDetail = (data?: any) =>
  request({
    headers: {
      'Content-type': 'text/plain'
    },
    baseURL: baseUrl,
    url: '/asset/query',
    method: 'post',
    data
  })

export const getGrantList = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/asset/grant/list',
    method: 'post',
    data
  })

export const grantDownFile = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/asset/grant/export',
    method: 'post',
    responseType: 'blob',
    data
  })

export const clearDownFile = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/asset/clear/export',
    method: 'post',
    responseType: 'blob',
    data
  })

export const onloanDownFile = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/asset/onloan/export',
    method: 'post',
    responseType: 'blob',
    data
  })

export const overdueDownFile = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/asset/overdue/export',
    method: 'post',
    responseType: 'blob',
    data
  })
export const getAssetAttachmentCleanProofList = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/channel/asset-attachment/clean-proof/query',
    method: 'post',
    data
  })
export const createAssetAttachmentCleanProof = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/channel/asset-attachment/clean-proof/create',
    method: 'post',
    data
  })
export const getChannelList = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/channel/list',
    method: 'post',
    data
  })
// 白名单管理 核心
export const whiteList = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/channel/customer-policies/list',
    method: 'post',
    data
  })
// 更新白名单
export const updateCustomer = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/channel/customer-policies/update',
    method: 'post',
    data
  })
// 新增白名单
export const addCustomer = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/channel/customer-policies/add',
    method: 'post',
    data
  })
// 新增白名单
export const getOrgList = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/channel/org/channel/list',
    method: 'post',
    data
  })
// 文件导入
export const fileCustomer = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/channel/customer-policies/upload-customer-policies-files',
    method: 'post',
    data
  })
